<script>
import Vue from 'vue';
import appUpdate from 'common/util/appUpdate.js';

export default {
	// 全局变量
	globalData: {
		jsapi_ticket: '',
		agent_ticket: '',
		corpid: 'ww3de4d7197f8aa5b7',
		agentid: 1000019
	},
	onLaunch: function (options) {
		uni.getSystemInfo({
			success: function (e) {
				// #ifdef APP-PLUS
				// 检测升级
				// appUpdate()
				// #endif
				// #ifndef MP
				Vue.prototype.StatusBar = e.statusBarHeight;
				if (e.platform == 'android') {
					Vue.prototype.CustomBar = e.statusBarHeight + 50;
				} else {
					Vue.prototype.CustomBar = e.statusBarHeight + 45;
				}
				// #endif

				// #ifdef MP-WEIXIN
				Vue.prototype.StatusBar = e.statusBarHeight;
				let custom = wx.getMenuButtonBoundingClientRect();
				Vue.prototype.Custom = custom;
				Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
				// #endif

				// #ifdef MP-ALIPAY
				Vue.prototype.StatusBar = e.statusBarHeight;
				Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
				// #endif
			}
		});
	},
	onShow: function (options) {
		// this.initWeComConfig()
	},
	onHide: function () {
		// console.log('App Hide');
	},
	methods: {
		async initWeComConfig(){
			const jsApiResp = await this.$api.getJsApiTicket();
			let jsapi_ticket = jsApiResp.Ticket;
			getApp().globalData.jsapi_ticket = jsapi_ticket
			
			const agentApiResp = await this.$api.getAgentTicket();
			let agent_ticket = agentApiResp.Ticket;
			getApp().globalData.agent_ticket = agent_ticket
		},
		
	}
};
</script>

<style lang="scss">
@import '@/uni_modules/uview-ui/index.scss';
@import '@/gflymob.scss';
.wrap {
	font-family: 'PingFang SC Regular';
}
</style>
